using System;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Wx.Sdk.App;
using Wx.Sdk.App.Base;

namespace Microsoft.Extensions.DependencyInjection;

public static class AppServiceCollectionExtensions
{
    public static IServiceCollection AddWxApp(this IServiceCollection services, Action<AppOption> action)
    {
        var opt = new AppOption();
        action.Invoke(opt);
        services.AddSingleton(opt);
        services.AddHttpClient();
        services.TryAddSingleton<WxApp>();
        return services;
    }
}

